package org.msn.component;

import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;

public abstract class AlertBox {
    private String title;
    private Stage window;

    public AlertBox(String title) {
        this.title = title;
        display();
    }

    protected void display() {
        window = new Stage();
        window.setTitle(this.title);
        window.initModality(Modality.APPLICATION_MODAL);
        window.setMinWidth(300);
        window.setMinHeight(150);

        Scene scene = slot();
        window.setScene(scene);
        window.showAndWait();
    }

    protected void close() {
        this.window.close();
    }

    public String getTitle() {
        return title;
    }

    protected abstract Scene slot();
}
